/*
 * @Description:
 * @version:
 * @Author: 尹鹏孝
 * @Date: 2023-07-08 16:15:26
 * @LastEditors: 尹鹏孝
 * @LastEditTime: 2023-08-06 13:12:18
 */
import { JwtStrategy } from './jwt.strategy';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { AuthService } from './auth.service';
import { User } from '../entity/user.entity';
import { UserDetail } from '../entity/userDetail.entity';
import { WEB_SALE_VALUE,JWT_TOKEN_EXPIRES_IN } from '../config/constant';
@Module({
    imports: [
        TypeOrmModule.forFeature([User,UserDetail]),
        PassportModule.register({ defaultStrategy: 'jwt' }),
        JwtModule.register({
            secret: WEB_SALE_VALUE,
            signOptions: { expiresIn: JWT_TOKEN_EXPIRES_IN }, // token 过期时效
        }),
    ],
    providers: [AuthService, JwtStrategy],
    exports: [AuthService],  // 因为auth模块需要导入到User模块，所以需要配置导出
})
export class AuthModule {}
